import { defineStore } from "pinia"
import { ref } from "vue"
import getData from "../utils/api"

// 用户模块
export const useUserStore = defineStore(
  "big-user",
  () => {
    const token = ref("") // 定义 token
    const setToken = (t) => (token.value = t) // 设置 token

    return { token, setToken }
  },
  {
    persist: true // 持久化
  }
)
export const useApiStore = defineStore({
  id: 'api',
  state: () => ({
    data: null, // 初始状态，这里假设数据是一个对象  
  }),
  actions: {
    setData(newData) {
      this.data = newData;
    },
  }
})
export const historicalStore = defineStore({
  id: 'historicalStore',
  state: () => ({
    data: null, // 初始状态，这里假设数据是一个对象  
  }),
  actions: {
    setData(newData) {
      this.data = newData;
    },
  }
})
